<!DOCTYPE html>
<html class="ui-page-login">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>忘记密码</title>
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/main.css" />
		<link href="../css/mui.picker.css" rel="stylesheet" />
		<link href="../css/mui.poppicker.css" rel="stylesheet" />
		<style>
			.mui-input-group:first-child {
				margin-top: 20px;
			}
			
			.mui-input-group label {
				width: 22%;
			}
			
			.mui-input-row label~input,
			.mui-input-row label~select,
			.mui-input-row label~textarea {
				width: 78%;
				height: 0.9rem;
				font-size: 14px;
			}
			
			.mui-checkbox input[type=checkbox],
			.mui-radio input[type=radio] {
				top: 6px;
			}
			
			.mui-content-padded {
				margin-top: 25px;
			}
			
			#reg {
				padding: 10px;
				border-radius: 15px;
				width: 80%;
				margin: 0 auto;
			}
			
			#reg span {
				font-size: 12px;
			}
			
			.mui-input-group {
				background: none;
			}
			
			.mui-input-group:before,
			.mui-input-group:after {
				height: 0;
			}
			
			.mui-input-group input {
				background-color: #FFFFFF;
				width: 87%;
				border-radius: 25px;
				margin: 15px;
			}
			
			.mui-input-group .mui-input-row:after {
				height: 0;
			}
			
			.mui-input-group .mui-input-row {
				text-align: center;
			}
			
			.mui-input-group .mui-input-row {
				height: inherit;
			}
			
			p {
				font-size: 14px;
				margin-top: 20px;
				margin-bottom: 10px;
				color: #8f8f94;
			}
			
			p a {
				color: #000000;
				padding: 0 20px;
			}
			
			.mui-content {
				background: none;
			}
			
			#showUserPicker {
				float: inherit;
				width: 87%;
				padding: 10px 15px;
			}
			
			.mui-input-group label {
				position: absolute;
				top: 5px;
				left: -5px;
			}
			
			.mui-input-group img {
				width: 0.69rem;
				vertical-align: -webkit-baseline-middle;
			}
			
			.mui-input-group input {
				background-color: #FFFFFF !important;
				width: 95% !important;
				border-radius: 25px !important;
				margin: 10px 0px 10px 0px!important;
				margin-top: 10px;
				padding-left: 55px !important;
				float: inherit !important;
			}
			
			#save {
				padding: 10px;
				border-radius: 20px;
				width: 100%;
				margin: 0 auto;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">忘记密码</h1>
		</header>
		<div class="mui-content">
			<form class="mui-input-group">

				<div class="mui-input-row">
					<label><img src="../images/exit/mm.png" /></label>
					<input id='setpassword' name='setpassword' type="password" class="mui-input password" placeholder="请输入新密码"></input>
				</div>
				<div class="mui-input-row">
					<label><img src="../images/exit/mm.png" /></label>
					<input id='doublepassword' name='doublepassword' type="password" class="mui-input password" placeholder="重复密码"></input>
				</div>
			</form>
			<div class="mui-content-padded">
				<button id='save' class="mui-btn mui-btn-block mui-btn-primary "><span>保存</span></button>
			</div>

		</div>
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/xiangyingshi.js"></script>
		<script src="../js/app.js"></script>
		<script type="text/javascript" src="../js/constants.js"></script>
		<script src="../js/mui.picker.js"></script>
		<script src="../js/mui.poppicker.js"></script>
		<script type="text/javascript" src="../plugs/moment/moment.min.js"></script>
		<script type="text/javascript" src="../js/json_time.js"></script>
		<script>
			(function($, doc) {
				$.init();
				$.plusReady(function() {
					if(plus.navigator.isImmersedStatusbar()) { // 兼容immersed状态栏模式
						// 获取状态栏高度并根据业务需求处理，这里重新计算了子窗口的偏移位置
						topoffset = (Math.round(plus.navigator.getStatusbarHeight()) + 45) + 'px';
						document.querySelector("header").style.height = topoffset;
						document.querySelector("header").style.paddingTop = "20px";
						document.querySelector(".mui-bar-nav~.mui-content").style.paddingTop = topoffset;
					}

					var currentView = plus.webview.currentWebview();
					currentView.show('slide-in-right', 200);
					plus.nativeUI.closeWaiting();
					var acount = '';
					var self = plus.webview.currentWebview();
					acount = self.ACOUNT;
					window.addEventListener('acount', function(event) {
						acount = event.detail.acount;
					});
					document.getElementById("save").addEventListener("tap", function(e) {
						var setpassword = document.getElementById("setpassword").value;
						var doublepassword = document.getElementById("doublepassword").value;
						if(setpassword != doublepassword) {
							mui.toast("您两次输入的密码不一致");
							return false;
						}
						var url = serverAddress + "/api/patient/appresetpassword";
						var xiugaiInfo = {
							account: acount,
							password: setpassword
						};
						var success = function(data) {
							//服务器返回响应，根据响应结果，分析是否登录成功；
							if(data.result == "success") {
								mui.toast("密码修改成功!");

								var index = plus.webview.getLaunchWebview();
								index.reload(true);
								plus.webview.currentWebview().opener().close(true);
								plus.webview.currentWebview().close(true);
								
								//								mui.openWindow({
								//									id: 'login.html',
								//									url: 'login.html',
								//									show: {
								//										autoShow: false, //页面loaded事件发生后自动显示，默认为true
								//										event: 'loaded' //页面显示时机，默认为titleUpdate事件时显示
								//									},
								//									waiting: {
								//										autoShow: true //自动显示等待框，默认为true
								//									}
								//								});
							}
							if(data.result == "error") {
								mui.toast("密码修改失败!");
							}

						};
						commonHttpUtils(url, "post", xiugaiInfo, success, error, true);
					})
				});
			}(mui, document));
		</script>
	</body>

</html>